﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GcmpModelInterface.h"
#include "NdbObjectSchematic.h"
#include "DbDataSchema.h"

namespace gcmp
{

    class IElement;
    class IGraphicsElementShape;
    class IGraphicsNodeIdAsker;

    /// \brief 造型操作的接口
    ///
    /// 
    class GCMP_MODEL_INTERFACE_EXPORT IModelingOperation : public IDbObject
    {
    private:
        DEFINE_CAST_DERIVED(gcmp::IModelingOperation, gcmp::IDbObject)

    public:

        /// \brief   造型操作的执行函数
        ///
        /// \param pElement   IElement的指针
        /// \param pGraphicsElementShape  IGraphicsElementShape的指针
        /// \return  true 成功;false，失败
        virtual bool Execute(IElement* pElement, IGraphicsElementShape* pGraphicsElementShape) = 0;

        /// \brief   设置造型操作Id
        ///
        /// \param operationId   造型操作Id
        /// \return 
        virtual void SetOperationId(Int32 operationId) = 0;

        /// \brief   获取造型操作Id
        ///
        /// \return 造型操作Id
        virtual Int32 GetOperationId()const = 0;

        /// \brief   重置造型操作
        ///
         virtual void Reset() = 0;

        /// \brief   创建GraphicsNodeId的查询类
        ///
        /// \param pElement  IElement的指针
        /// \return 
        virtual OwnerPtr<IGraphicsNodeIdAsker> CreateGraphicsNodeIdAsker(IElement* pElement) = 0;

        /// \brief   判断id是否是面类型
        /// 
        /// \param id  面的Id
        /// \return  true 成功;false，失败
        virtual bool IsFace(int id)const = 0;

        /// \brief   判断id是否是边类型
        ///  
        /// \param id 边的Id
        /// \return true 成功;false，失败
        virtual bool IsEdge(int id)const = 0;

        /// \brief    获取该Operation,父子关系Id的映射
        /// 
        /// \return  映射关系
        virtual const std::unordered_map<int, int>& GetChildToParentIdMap()const = 0;

        /// \brief 设置该行为所属Element
        /// \param pOwnerElement 所属Element
        /// \return bool
        virtual bool SetOwnerElement(IElement* pOwnerElement);

        /// \brief 获得该外部对象所属Element
        /// \return const IElement* 所属Element
        virtual const IElement* GetOwnerElement() const;

        /// \brief 获得该外部对象所属Element
        /// \return IElement* 所属Element
        virtual IElement* GetOwnerElement();
    };
}


